package com.xjx.controller;

import com.xjx.enmus.ExpressStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/express")
public class ExpressController {

    @GetMapping("/{status}")
    public ResponseEntity<String> getExpressStatusDescription(@PathVariable String status) {
        try {
            ExpressStatus expressStatus = ExpressStatus.valueOf(status.toUpperCase());
            return ResponseEntity.ok(expressStatus.getDescription());
        } catch (IllegalArgumentException e) {
            return ResponseEntity.badRequest().body("无效的快递状态: " + status);
        }
    }
}
